package com.dingwei.superiordiary.mvp.presenter;

import com.dingwei.superiordiary.base.MyBaseBean;
import com.dingwei.superiordiary.bean.FailsBean;
import com.dingwei.superiordiary.bean.ShareBean;
import com.dingwei.superiordiary.custom.myCallback;
import com.dingwei.superiordiary.mvp.view.Contract;
import com.lihao.baselibrary.base.BaseActivity;
import com.lihao.baselibrary.base.URLS;
import com.lihao.baselibrary.base.basePresenter;

import org.xutils.http.RequestParams;
import org.xutils.x;

/**
 * Created by lihao on 2017/9/12.
 */

public class SharePresenter extends basePresenter {

    private Contract.ShareView shareView;

    public SharePresenter(Contract.ShareView view) {
        super(view);
        this.shareView = view;
    }
    public void initData(final String type){
              RequestParams rp = new RequestParams(URLS.HOST+URLS.get_Sharp);
                    x.http().post(rp, new myCallback(BaseActivity.context, ShareBean.class,rp) {
                        @Override
                        public void back(MyBaseBean baseBean, String result) {
                            ShareBean bean = (ShareBean) baseBean;
                            shareView.share(bean,type);
                        }

                        @Override
                        public void fail(FailsBean baseBean, String result) {
                        }
                    });
    }

}
